package com.foredu.fiqs.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * Description:<br/>
 * 领域模型：工资条目类，教职工工资包含若干工资条目<br/>
 * Date:<br/>
 * 2014/5/13<br/>
 * 
 * @author hushigang
 */

@Entity
@Table(name = "T_SalaryItem")
public class SalaryItem implements Serializable {

	private static final long serialVersionUID = 1L;
	private int id;// 工资条目ID
	private SalaryItemType type;//工资条目类型
	private float total;// 工资条目金额总计
	private Salary salary;// 所属工资
	private Set<SalaryItemDetail> salaryItemDetails;// 工资条目明细集合

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@Column
	public float getTotal() {
		return total;
	}

	public void setTotal(float total) {
		this.total = total;
	}

	@OneToMany(cascade=CascadeType.ALL, mappedBy = "salaryItem")
	@OrderBy(value = "id ASC")
	public Set<SalaryItemDetail> getSalaryItemDetails() {
		return salaryItemDetails;
	}

	public void setSalaryItemDetails(Set<SalaryItemDetail> salaryItemDetails) {
		this.salaryItemDetails = salaryItemDetails;
	}

	@ManyToOne
	@JoinColumn(name = "salary_id")
	public Salary getSalary() {
		return salary;
	}

	public void setSalary(Salary salary) {
		this.salary = salary;
	}

	@ManyToOne
	@JoinColumn(name = "salaryItemType_id")
	public SalaryItemType getType() {
		return type;
	}
	
	public void setType(SalaryItemType type) {
		this.type = type;
	}
}
